home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gnome-vfs-2.0 / libgnomevfs / gnome-vfs-uri.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-05-01  |  7.4 KB  |  207 lines

  1. /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
  2. /* gnome-vfs-uri.h - URI handling for the GNOME Virtual File System.
  3.  
  4.    Copyright (C) 1999 Free Software Foundation
  5.  
  6.    The Gnome Library is free software; you can redistribute it and/or
  7.    modify it under the terms of the GNU Library General Public License as
  8.    published by the Free Software Foundation; either version 2 of the
  9.    License, or (at your option) any later version.
  10.  
  11.    The Gnome Library is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  14.    Library General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU Library General Public
  17.    License along with the Gnome Library; see the file COPYING.LIB.  If not,
  18.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.    Boston, MA 02111-1307, USA.
  20.  
  21.    Author: Ettore Perazzoli <ettore@comm2000.it>
  22. */
  23.  
  24. #ifndef GNOME_VFS_URI_H
  25. #define GNOME_VFS_URI_H
  26.  
  27. #include <glib/glist.h>
  28. #include <glib-object.h> /* For GType */
  29.  
  30. G_BEGIN_DECLS
  31.  
  32. /* This describes a URI element.  */
  33. typedef struct GnomeVFSURI {
  34.     /* Reference count.  */
  35.     guint ref_count;
  36.  
  37.     /* Text for the element: eg. some/path/name.  */
  38.     gchar *text;
  39.  
  40.     /* Text for uri fragment: eg, #anchor  */
  41.     gchar *fragment_id;
  42.     
  43.     /* Method string: eg. `gzip', `tar', `http'.  This is necessary as
  44.        one GnomeVFSMethod can be used for different method strings
  45.        (e.g. extfs handles zip, rar, zoo and several other ones).  */
  46.     gchar *method_string;
  47.  
  48.     /* VFS method to access the element.  */
  49.     struct GnomeVFSMethod *method;
  50.  
  51.     /* Pointer to the parent element, or NULL for toplevel elements.  */
  52.     struct GnomeVFSURI *parent;
  53.  
  54.     /* Reserved to avoid future breaks in ABI compatibility */
  55.     void *reserved1;
  56.     void *reserved2;
  57. } GnomeVFSURI;
  58.  
  59. /* This is the toplevel URI element.  A toplevel method implementations should
  60.    cast the `GnomeVFSURI' argument to this type to get the additional host/auth
  61.    information.  If any of the elements is 0, it is unspecified.  */
  62. typedef struct {
  63.     /* Base object.  */
  64.     GnomeVFSURI uri;
  65.  
  66.     /* Server location information.  */
  67.     gchar *host_name;
  68.     guint host_port;
  69.  
  70.     /* Authorization information. (unescaped) */
  71.     gchar *user_name;
  72.     gchar *password;
  73.  
  74.     /* The parent URN, if it exists */
  75.     gchar *urn;
  76.  
  77.     /* Reserved to avoid future breaks in ABI compatibility */
  78.     void *reserved1;
  79.     void *reserved2;
  80.  
  81. } GnomeVFSToplevelURI;
  82.  
  83.  
  84. /**
  85.  * GnomeVFSURIHideOptions:
  86.  * @GNOME_VFS_URI_HIDE_NONE: don't hide anything
  87.  * @GNOME_VFS_URI_HIDE_USER_NAME: hide the user name
  88.  * @GNOME_VFS_URI_HIDE_PASSWORD: hide the password
  89.  * @GNOME_VFS_URI_HIDE_HOST_NAME: hide the host name
  90.  * @GNOME_VFS_URI_HIDE_HOST_PORT: hide the port
  91.  * @GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD: hide the method (e.g. http, file)
  92.  * @GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER: hide the fragment identifier
  93.  *
  94.  * Packed boolean bitfield controlling hiding of various elements
  95.  * of a GnomeVFSURI when it is converted to a string.
  96.  **/
  97. typedef enum
  98. {
  99.     GNOME_VFS_URI_HIDE_NONE = 0,
  100.     GNOME_VFS_URI_HIDE_USER_NAME = 1 << 0,
  101.     GNOME_VFS_URI_HIDE_PASSWORD = 1 << 1,
  102.     GNOME_VFS_URI_HIDE_HOST_NAME = 1 << 2,
  103.     GNOME_VFS_URI_HIDE_HOST_PORT = 1 << 3,
  104.     GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD = 1 << 4,
  105.     GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER = 1 << 8
  106. } GnomeVFSURIHideOptions; 
  107.  
  108. GType gnome_vfs_uri_hide_options_get_type (void);
  109. #define GNOME_VFS_TYPE_VFS_URI_HIDE_OPTIONS (gnome_vfs_uri_hide_options_get_type())
  110.  
  111.  
  112. /**
  113.  * GNOME_VFS_URI_MAGIC_CHR:
  114.  *
  115.  * The character used to divide location from
  116.  * extra "arguments" passed to the method.
  117.  **/
  118. /**
  119.  * GNOME_VFS_URI_MAGIC_STR:
  120.  *
  121.  * The character used to divide location from
  122.  * extra "arguments" passed to the method.
  123.  **/
  124. #define GNOME_VFS_URI_MAGIC_CHR    '#'
  125. #define GNOME_VFS_URI_MAGIC_STR "#"
  126.  
  127. /**
  128.  * GNOME_VFS_URI_PATH_CHR:
  129.  *
  130.  * Defines the path seperator character.
  131.  **/
  132. /**
  133.  * GNOME_VFS_URI_PATH_STR:
  134.  *
  135.  * Defines the path seperator string.
  136.  **/
  137. #define GNOME_VFS_URI_PATH_CHR '/'
  138. #define GNOME_VFS_URI_PATH_STR "/"
  139.  
  140. /* FUNCTIONS */
  141. GnomeVFSURI          *gnome_vfs_uri_new                   (const gchar *text_uri);
  142. GnomeVFSURI          *gnome_vfs_uri_resolve_relative      (const GnomeVFSURI *base,
  143.                                const gchar *relative_reference);
  144. GnomeVFSURI          *gnome_vfs_uri_ref                   (GnomeVFSURI *uri);
  145. void                  gnome_vfs_uri_unref                 (GnomeVFSURI *uri);
  146.  
  147. GnomeVFSURI          *gnome_vfs_uri_append_string         (const GnomeVFSURI *uri,
  148.                                    const char *uri_fragment);
  149. GnomeVFSURI          *gnome_vfs_uri_append_path           (const GnomeVFSURI *uri,
  150.                                    const char *path);
  151. GnomeVFSURI          *gnome_vfs_uri_append_file_name      (const GnomeVFSURI *uri,
  152.                                    const gchar *filename);
  153. gchar                *gnome_vfs_uri_to_string             (const GnomeVFSURI *uri,
  154.                                    GnomeVFSURIHideOptions hide_options);
  155. GnomeVFSURI          *gnome_vfs_uri_dup                   (const GnomeVFSURI *uri);
  156. gboolean              gnome_vfs_uri_is_local              (const GnomeVFSURI *uri);
  157. gboolean          gnome_vfs_uri_has_parent              (const GnomeVFSURI *uri);
  158. GnomeVFSURI         *gnome_vfs_uri_get_parent            (const GnomeVFSURI *uri);
  159.  
  160. GnomeVFSToplevelURI *gnome_vfs_uri_get_toplevel           (const GnomeVFSURI *uri);
  161.  
  162. const gchar         *gnome_vfs_uri_get_host_name          (const GnomeVFSURI *uri);
  163. const gchar         *gnome_vfs_uri_get_scheme             (const GnomeVFSURI *uri);
  164. guint                  gnome_vfs_uri_get_host_port          (const GnomeVFSURI *uri);
  165. const gchar         *gnome_vfs_uri_get_user_name          (const GnomeVFSURI *uri);
  166. const gchar        *gnome_vfs_uri_get_password           (const GnomeVFSURI *uri);
  167.  
  168. void             gnome_vfs_uri_set_host_name          (GnomeVFSURI *uri,
  169.                                    const gchar *host_name);
  170. void                  gnome_vfs_uri_set_host_port          (GnomeVFSURI *uri,
  171.                                    guint host_port);
  172. void             gnome_vfs_uri_set_user_name          (GnomeVFSURI *uri,
  173.                                    const gchar *user_name);
  174. void             gnome_vfs_uri_set_password           (GnomeVFSURI *uri,
  175.                                    const gchar *password);
  176.  
  177. gboolean         gnome_vfs_uri_equal              (const GnomeVFSURI *a,
  178.                                    const GnomeVFSURI *b);
  179.  
  180. gboolean         gnome_vfs_uri_is_parent              (const GnomeVFSURI *possible_parent,
  181.                                    const GnomeVFSURI *possible_child,
  182.                                    gboolean recursive);
  183.                   
  184. const gchar         *gnome_vfs_uri_get_path                (const GnomeVFSURI *uri);
  185. const gchar         *gnome_vfs_uri_get_fragment_identifier (const GnomeVFSURI *uri);
  186. gchar             *gnome_vfs_uri_extract_dirname         (const GnomeVFSURI *uri);
  187. gchar            *gnome_vfs_uri_extract_short_name      (const GnomeVFSURI *uri);
  188. gchar            *gnome_vfs_uri_extract_short_path_name (const GnomeVFSURI *uri);
  189.  
  190. gint             gnome_vfs_uri_hequal                (gconstpointer a,
  191.                                     gconstpointer b);
  192. guint             gnome_vfs_uri_hash                   (gconstpointer p);
  193.  
  194. GList               *gnome_vfs_uri_list_parse              (const gchar* uri_list);
  195. GList               *gnome_vfs_uri_list_ref                (GList *list);
  196. GList               *gnome_vfs_uri_list_unref              (GList *list);
  197. GList               *gnome_vfs_uri_list_copy               (GList *list);
  198. void                 gnome_vfs_uri_list_free               (GList *list);
  199.  
  200. char                *gnome_vfs_uri_make_full_from_relative (const char *base_uri,
  201.                                 const char *relative_uri);
  202.  
  203.  
  204. G_END_DECLS
  205.  
  206. #endif /* GNOME_VFS_URI_H */
  207.